//
//  HNCreditGoidPushFunction.m
//  XDEducation
//
//  Created by 星道 on 17/6/1.
//  Copyright © 2017年 apple. All rights reserved.
//

#import "HNCreditGoidPushFunction.h"
#import "HNCreditGoldSelectView.h"
#import "HNCreditGoidHaiZi.h"
#import "HNCreditGoidJiaZhang.h"
#import "HNCreditGoidLaoShi.h"
@implementation HNCreditGoidPushFunction
{
    UIViewController *_ViewController;
}

- (instancetype)initWithViewController:(UIViewController *)ViewController
{
    self = [super init];
    if (self)
    {
        _ViewController = ViewController;
        
        
        //打开选择
        HNCreditGoldSelectView *SelectView = [[HNCreditGoldSelectView alloc] initWithTitle_Arr:[self GetCreditGoldStr] SelectRow:^(NSString *Title) {
            
            NSInteger rolecode = [[AccountTool shareAccountTool].currentAccount.rolecode integerValue];
            if (rolecode == 2) //老师
            {
                HNCreditGoidLaoShi *VC = [[HNCreditGoidLaoShi alloc] init_GetLaoShiInfoWithVC:_ViewController];
                [VC SelectRowWithTitle:Title];
            }
            else if (rolecode == 3) //家长
            {
                HNCreditGoidJiaZhang *VC = [[HNCreditGoidJiaZhang alloc] init_GetJiaZhangInfoWithVC:_ViewController];
                [VC SelectRowWithTitle:Title];
            }
            else if (rolecode == 4) //孩子
            {
                HNCreditGoidHaiZi *VC = [[HNCreditGoidHaiZi alloc] init_GetHaiInfoWithVC:_ViewController];
                [VC SelectRowWithTitle:Title];
            }
            else
            {
            }
        }];
        [[UIApplication sharedApplication].keyWindow.rootViewController.view addSubview:SelectView];
        
    }
    return self;
}



/** 诚信是金的角色字符 */
- (NSArray *)GetCreditGoldStr
{
    if ([[AccountTool shareAccountTool].currentAccount.rolecode isEqualToString:@"2"])
    {
        return @[@"学生",@"自己"];
    }
    else if ([[AccountTool shareAccountTool].currentAccount.rolecode isEqualToString:@"3"])
    {
        return [HNCreditGoidJiaZhang GetJiaZhangInfo];
    }
    else if ([[AccountTool shareAccountTool].currentAccount.rolecode isEqualToString:@"4"])
    {
        return [HNCreditGoidHaiZi GetHaiZiInfo];
    }
    else
    {
        return nil;
    }
}
@end
